/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.logistics.entity.customsdeclaration;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.base.entity.customer.Customer;
import com.jeesite.modules.base.entity.supplier.Supplier;
import com.jeesite.modules.financial.entity.declarationnotice.TdeclarationNotice;
import com.jeesite.modules.financial.entity.lettercredit.LetterCredit;
import com.jeesite.modules.order.entity.serviceorder.ServiceOrder;
import com.jeesite.modules.order.entity.serviceorder.ServiceOrderDetail;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

/**
 * 报关Entity
 *
 * @author LV
 * @version 2021-03-10
 */
@Table(name = "t_customs_declaration", alias = "a", columns = {
        @Column(name = "customs_declaration_id", attrName = "customsDeclarationId", label = "报关单ID", isPK = true),
        @Column(name = "customs_declaration_code", attrName = "customsDeclarationCode", label = "单据编号", queryType = QueryType.LIKE),
        @Column(name = "service_order_id", attrName = "serviceOrderId", label = "服务订单"),
        @Column(name = "customer_id", attrName = "customerId", label = "客户名称"),
        @Column(name = "letter_credit_code", attrName = "letterCreditCode", label = "信用证编号", isQuery = false),
        @Column(name = "currency", attrName = "currency", label = "币种", isQuery = false),
        @Column(name = "investor_id", attrName = "investorId", label = "资方", isQuery = false),
        @Column(name = "customs_declaration_notice_code", attrName = "customsDeclarationNoticeCode", label = "报关通知", isQuery = false),
        @Column(name = "customs_broker", attrName = "customsBroker", label = "报关行"),
        @Column(name = "date", attrName = "date", label = "放行日期"),
        @Column(name = "declare_date", attrName = "declareDate", label = "申报日期"),
        @Column(name = "remarks", attrName = "remarks", label = "备注信息", isQuery = false),
        @Column(name = "tax_payment_method", attrName = "taxPaymentMethod", label = "缴税方式"),
        @Column(name = "tax_payment_way", attrName = "taxPaymentWay", label = "缴税单位"),
        @Column(name = "tax_date", attrName = "taxDate", label = "出税日期"),
        @Column(name = "tax_deadline_date", attrName = "taxDeadlineDate", label = "缴税截止日期"),
        @Column(name = "actual_tax_date", attrName = "actualTaxDate", label = "实际缴税日期"),
        @Column(name = "customs_declaration_date", attrName = "customsDeclarationDate", label = "收到报关单据日期"),
        @Column(name = "bill_date", attrName = "billDate", label = "收到报关单日期"),
        @Column(name = "create_by", attrName = "createBy", label = "创建者", isUpdate = false),
        @Column(name = "create_date", attrName = "createDate", label = "创建时间", isUpdate = false),
        @Column(name = "update_by", attrName = "updateBy", label = "更新者", isQuery = false),
        @Column(name = "update_date", attrName = "updateDate", label = "更新时间", isQuery = false),
}, joinTable = {
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Customer.class, attrName = "customer", alias = "b",
                on = "b.customer_id = a.customer_id", columns = {
                @Column(name = "customer_id", label = "客户编号", isPK = true),
                @Column(name = "customer_name", label = "客户名称"),
        }),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = ServiceOrder.class, attrName = "serviceOrder", alias = "c",
                on = "c.service_order_id = a.service_order_id",
                columns = {
                        @Column(name = "service_order_id", label = "服务订单ID", isPK = true),
                        @Column(name = "service_order_code", label = "服务订单编号"),
                }),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Supplier.class, attrName = "inSupplier", alias = "d",
                on = "d.supplier_id = a.investor_id",
                columns = {
                        @Column(name = "supplier_id", label = "供应商编号", isPK = true),
                        @Column(name = "supplier_name", label = "供应商名称"),
                }),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = TdeclarationNotice.class, attrName = "declarationNotice", alias = "e",
                on = "e.customs_declaration_notice_id = a.customs_declaration_notice_code",
                columns = {
                        @Column(name = "customs_declaration_notice_id", label = "报关通知ID", isPK = true),
                        @Column(name = "customs_declaration_notice_code", label = "报关通知编号"),
                }),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = LetterCredit.class, attrName = "letterCredit", alias = "f",
                on = "f.letter_credit_id = a.letter_credit_code",
                columns = {
                        @Column(name = "letter_credit_id", label = "信用证ID", isPK = true),
                        @Column(name = "letter_credit_code", label = "信用证编号"),
                }),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Supplier.class, attrName = "brolerSupplier", alias = "g",
                on = "g.supplier_id = a.customs_broker",
                columns = {
                        @Column(name = "supplier_id", label = "供应商编号", isPK = true),
                        @Column(name = "supplier_name", label = "供应商名称"),
                })
}, orderBy = "a.update_date DESC"
)
public class CustomsDeclaration extends DataEntity<CustomsDeclaration> {

    private static final long serialVersionUID = 1L;
    private String customsDeclarationId;        // 报关单ID
    private String customsDeclarationCode;        // 单据编号
    private String serviceOrderId;        // 服务订单
    private ServiceOrder serviceOrder;
    private String customerId;        // 客户名称
    private Customer customer;
    private String letterCreditCode;        // 信用证编号
    private LetterCredit letterCredit;
    private String currency;        // 币种
    private String investorId;        // 资方
    private Supplier inSupplier;
    private String customsDeclarationNoticeCode;        // 报关通知
    private TdeclarationNotice declarationNotice;
    private String customsBroker;        // 报关行
    private Supplier brolerSupplier;
    private Date date;        // 放行日期
    private Date declareDate;        // 申报日期
    private String taxPaymentMethod;        // 缴税方式
    private String taxPaymentWay;        // 缴税单位
    private Date taxDate;        // 出税日期
    private Date taxDeadlineDate;        // 缴税截止日期
    private Date actualTaxDate;        // 实际缴税日期
    private Date customsDeclarationDate;        // 收到报关单据日期
    private Date billDate;        // 收到报关单日期
    private List<CustomsDeclarationDetail> customsDeclarationDetailList = ListUtils.newArrayList();        // 子表列表

    // 明细合计信息
    private Double foreignCurrencyPrice1;
    private Double declaredPrice1;
    private Double taxPrice1;
    private Double importDuty1;
    private Double importConsumptionTax1;
    private Double importVat1;
    private Double comprehensiveTax1;
    private Double taxAmount1;

    //服务详细信息
    private ServiceOrderDetail serviceOrderDetail;

    private String customerName;

    private String frameNumber;

    private String carId;

    private String carName;

    private String area;

    private String submitStatus;

    private String tgRemark;

    public CustomsDeclaration() {
        this(null);
    }

    public CustomsDeclaration(String id) {
        super(id);
    }

    public String getCustomsDeclarationId() {
        return customsDeclarationId;
    }

    public void setCustomsDeclarationId(String customsDeclarationId) {
        this.customsDeclarationId = customsDeclarationId;
    }

    @Length(min = 0, max = 100, message = "单据编号长度不能超过 100 个字符")
    public String getCustomsDeclarationCode() {
        return customsDeclarationCode;
    }

    public void setCustomsDeclarationCode(String customsDeclarationCode) {
        this.customsDeclarationCode = customsDeclarationCode;
    }

    @Length(min = 0, max = 64, message = "服务订单长度不能超过 64 个字符")
    public String getServiceOrderId() {
        return serviceOrderId;
    }

    public void setServiceOrderId(String serviceOrderId) {
        this.serviceOrderId = serviceOrderId;
    }

    @Length(min = 0, max = 64, message = "客户名称长度不能超过 64 个字符")
    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    @Length(min = 0, max = 100, message = "信用证编号长度不能超过 100 个字符")
    public String getLetterCreditCode() {
        return letterCreditCode;
    }

    public void setLetterCreditCode(String letterCreditCode) {
        this.letterCreditCode = letterCreditCode;
    }

    @Length(min = 0, max = 2, message = "币种长度不能超过 2 个字符")
    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    @Length(min = 0, max = 64, message = "资方长度不能超过 64 个字符")
    public String getInvestorId() {
        return investorId;
    }

    public void setInvestorId(String investorId) {
        this.investorId = investorId;
    }

    @Length(min = 0, max = 100, message = "报关通知长度不能超过 100 个字符")
    public String getCustomsDeclarationNoticeCode() {
        return customsDeclarationNoticeCode;
    }

    public void setCustomsDeclarationNoticeCode(String customsDeclarationNoticeCode) {
        this.customsDeclarationNoticeCode = customsDeclarationNoticeCode;
    }

    @Length(min = 0, max = 64, message = "报关行长度不能超过 64 个字符")
    public String getCustomsBroker() {
        return customsBroker;
    }

    public void setCustomsBroker(String customsBroker) {
        this.customsBroker = customsBroker;
    }

    @JsonFormat(pattern = "yyyy-MM-dd")
    @NotNull(message = "放行日期不能为空")
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @JsonFormat(pattern = "yyyy-MM-dd")
    @NotNull(message = "申报日期不能为空")
    public Date getDeclareDate() {
        return declareDate;
    }

    public void setDeclareDate(Date declareDate) {
        this.declareDate = declareDate;
    }

    @Length(min = 0, max = 2, message = "缴税方式长度不能超过 2 个字符")
    public String getTaxPaymentMethod() {
        return taxPaymentMethod;
    }

    public void setTaxPaymentMethod(String taxPaymentMethod) {
        this.taxPaymentMethod = taxPaymentMethod;
    }

    @Length(min = 0, max = 2, message = "缴税单位长度不能超过 2 个字符")
    public String getTaxPaymentWay() {
        return taxPaymentWay;
    }

    public void setTaxPaymentWay(String taxPaymentWay) {
        this.taxPaymentWay = taxPaymentWay;
    }

    @JsonFormat(pattern = "yyyy-MM-dd")
    @NotNull(message = "出税日期不能为空")
    public Date getTaxDate() {
        return taxDate;
    }

    public void setTaxDate(Date taxDate) {
        this.taxDate = taxDate;
    }

    @JsonFormat(pattern = "yyyy-MM-dd")
    @NotNull(message = "缴税截止日期不能为空")
    public Date getTaxDeadlineDate() {
        return taxDeadlineDate;
    }

    public void setTaxDeadlineDate(Date taxDeadlineDate) {
        this.taxDeadlineDate = taxDeadlineDate;
    }

    @JsonFormat(pattern = "yyyy-MM-dd")
    public Date getActualTaxDate() {
        return actualTaxDate;
    }

    public void setActualTaxDate(Date actualTaxDate) {
        this.actualTaxDate = actualTaxDate;
    }

    @JsonFormat(pattern = "yyyy-MM-dd")
    public Date getCustomsDeclarationDate() {
        return customsDeclarationDate;
    }

    public void setCustomsDeclarationDate(Date customsDeclarationDate) {
        this.customsDeclarationDate = customsDeclarationDate;
    }

    @JsonFormat(pattern = "yyyy-MM-dd")
    public Date getBillDate() {
        return billDate;
    }

    public void setBillDate(Date billDate) {
        this.billDate = billDate;
    }

    public Date getDate_gte() {
        return sqlMap.getWhere().getValue("date", QueryType.GTE);
    }

    public void setDate_gte(Date date) {
        sqlMap.getWhere().and("date", QueryType.GTE, date);
    }

    public Date getDate_lte() {
        return sqlMap.getWhere().getValue("date", QueryType.LTE);
    }

    public void setDate_lte(Date date) {
        sqlMap.getWhere().and("date", QueryType.LTE, date);
    }

    public Date getDeclareDate_gte() {
        return sqlMap.getWhere().getValue("declare_date", QueryType.GTE);
    }

    public void setDeclareDate_gte(Date declareDate) {
        sqlMap.getWhere().and("declare_date", QueryType.GTE, declareDate);
    }

    public Date getDeclareDate_lte() {
        return sqlMap.getWhere().getValue("declare_date", QueryType.LTE);
    }

    public void setDeclareDate_lte(Date declareDate) {
        sqlMap.getWhere().and("declare_date", QueryType.LTE, declareDate);
    }

    public Date getTaxDate_gte() {
        return sqlMap.getWhere().getValue("tax_date", QueryType.GTE);
    }

    public void setTaxDate_gte(Date taxDate) {
        sqlMap.getWhere().and("tax_date", QueryType.GTE, taxDate);
    }

    public Date getTaxDate_lte() {
        return sqlMap.getWhere().getValue("tax_date", QueryType.LTE);
    }

    public void setTaxDate_lte(Date taxDate) {
        sqlMap.getWhere().and("tax_date", QueryType.LTE, taxDate);
    }

    public Date getTaxDeadlineDate_gte() {
        return sqlMap.getWhere().getValue("tax_deadline_date", QueryType.GTE);
    }

    public void setTaxDeadlineDate_gte(Date taxDeadlineDate) {
        sqlMap.getWhere().and("tax_deadline_date", QueryType.GTE, taxDeadlineDate);
    }

    public Date getTaxDeadlineDate_lte() {
        return sqlMap.getWhere().getValue("tax_deadline_date", QueryType.LTE);
    }

    public void setTaxDeadlineDate_lte(Date taxDeadlineDate) {
        sqlMap.getWhere().and("tax_deadline_date", QueryType.LTE, taxDeadlineDate);
    }

    public Date getActualTaxDate_gte() {
        return sqlMap.getWhere().getValue("actual_tax_date", QueryType.GTE);
    }

    public void setActualTaxDate_gte(Date actualTaxDate) {
        sqlMap.getWhere().and("actual_tax_date", QueryType.GTE, actualTaxDate);
    }

    public Date getActualTaxDate_lte() {
        return sqlMap.getWhere().getValue("actual_tax_date", QueryType.LTE);
    }

    public void setActualTaxDate_lte(Date actualTaxDate) {
        sqlMap.getWhere().and("actual_tax_date", QueryType.LTE, actualTaxDate);
    }

    public Date getCustomsDeclarationDate_gte() {
        return sqlMap.getWhere().getValue("customs_declaration_date", QueryType.GTE);
    }

    public void setCustomsDeclarationDate_gte(Date customsDeclarationDate) {
        sqlMap.getWhere().and("customs_declaration_date", QueryType.GTE, customsDeclarationDate);
    }

    public Date getCustomsDeclarationDate_lte() {
        return sqlMap.getWhere().getValue("customs_declaration_date", QueryType.LTE);
    }

    public void setCustomsDeclarationDate_lte(Date customsDeclarationDate) {
        sqlMap.getWhere().and("customs_declaration_date", QueryType.LTE, customsDeclarationDate);
    }

    public Date getBillDate_gte() {
        return sqlMap.getWhere().getValue("bill_date", QueryType.GTE);
    }

    public void setBillDate_gte(Date billDate) {
        sqlMap.getWhere().and("bill_date", QueryType.GTE, billDate);
    }

    public Date getBillDate_lte() {
        return sqlMap.getWhere().getValue("bill_date", QueryType.LTE);
    }

    public void setBillDate_lte(Date billDate) {
        sqlMap.getWhere().and("bill_date", QueryType.LTE, billDate);
    }

    public Date getCreateDate_gte() {
        return sqlMap.getWhere().getValue("create_date", QueryType.GTE);
    }

    public void setCreateDate_gte(Date createDate) {
        sqlMap.getWhere().and("create_date", QueryType.GTE, createDate);
    }

    public Date getCreateDate_lte() {
        return sqlMap.getWhere().getValue("create_date", QueryType.LTE);
    }

    public void setCreateDate_lte(Date createDate) {
        sqlMap.getWhere().and("create_date", QueryType.LTE, createDate);
    }

    public List<CustomsDeclarationDetail> getCustomsDeclarationDetailList() {
        return customsDeclarationDetailList;
    }

    public void setCustomsDeclarationDetailList(List<CustomsDeclarationDetail> customsDeclarationDetailList) {
        this.customsDeclarationDetailList = customsDeclarationDetailList;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public ServiceOrder getServiceOrder() {
        return serviceOrder;
    }

    public void setServiceOrder(ServiceOrder serviceOrder) {
        this.serviceOrder = serviceOrder;
    }

    public Supplier getInSupplier() {
        return inSupplier;
    }

    public void setInSupplier(Supplier inSupplier) {
        this.inSupplier = inSupplier;
    }

    public TdeclarationNotice getDeclarationNotice() {
        return declarationNotice;
    }

    public void setDeclarationNotice(TdeclarationNotice declarationNotice) {
        this.declarationNotice = declarationNotice;
    }

    public Double getForeignCurrencyPrice1() {
        return foreignCurrencyPrice1;
    }

    public void setForeignCurrencyPrice1(Double foreignCurrencyPrice1) {
        this.foreignCurrencyPrice1 = foreignCurrencyPrice1;
    }

    public Double getDeclaredPrice1() {
        return declaredPrice1;
    }

    public void setDeclaredPrice1(Double declaredPrice1) {
        this.declaredPrice1 = declaredPrice1;
    }

    public Double getTaxPrice1() {
        return taxPrice1;
    }

    public void setTaxPrice1(Double taxPrice1) {
        this.taxPrice1 = taxPrice1;
    }

    public Double getImportDuty1() {
        return importDuty1;
    }

    public void setImportDuty1(Double importDuty1) {
        this.importDuty1 = importDuty1;
    }

    public Double getImportConsumptionTax1() {
        return importConsumptionTax1;
    }

    public void setImportConsumptionTax1(Double importConsumptionTax1) {
        this.importConsumptionTax1 = importConsumptionTax1;
    }

    public Double getImportVat1() {
        return importVat1;
    }

    public void setImportVat1(Double importVat1) {
        this.importVat1 = importVat1;
    }

    public Double getComprehensiveTax1() {
        return comprehensiveTax1;
    }

    public void setComprehensiveTax1(Double comprehensiveTax1) {
        this.comprehensiveTax1 = comprehensiveTax1;
    }

    public Double getTaxAmount1() {
        return taxAmount1;
    }

    public void setTaxAmount1(Double taxAmount1) {
        this.taxAmount1 = taxAmount1;
    }

    public LetterCredit getLetterCredit() {
        return letterCredit;
    }

    public void setLetterCredit(LetterCredit letterCredit) {
        this.letterCredit = letterCredit;
    }

    public Supplier getBrolerSupplier() {
        return brolerSupplier;
    }

    public void setBrolerSupplier(Supplier brolerSupplier) {
        this.brolerSupplier = brolerSupplier;
    }

    public ServiceOrderDetail getServiceOrderDetail() {
        return serviceOrderDetail;
    }

    public void setServiceOrderDetail(ServiceOrderDetail serviceOrderDetail) {
        this.serviceOrderDetail = serviceOrderDetail;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public String getFrameNumber() {
        return frameNumber;
    }

    public void setFrameNumber(String frameNumber) {
        this.frameNumber = frameNumber;
    }

    public String getCarId() {
        return carId;
    }

    public void setCarId(String carId) {
        this.carId = carId;
    }

    public String getCarName() {
        return carName;
    }

    public void setCarName(String carName) {
        this.carName = carName;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getSubmitStatus() {
        return submitStatus;
    }

    public void setSubmitStatus(String submitStatus) {
        this.submitStatus = submitStatus;
    }

    public String getTgRemark() {
        return tgRemark;
    }

    public void setTgRemark(String tgRemark) {
        this.tgRemark = tgRemark;
    }
}
